package com.hksj.cm.controller;

import com.hksj.cm.dto.CleanlinessLevelDTO;
import com.hksj.cm.service.CleanlinessLevelService;
import com.hksj.cm.vo.CleanlinessLevelVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName ProportionCleanLevelController
 * @Description TODO
 * @Author @陈章
 * @Date 2024/7/16 8:53
 * @Version 1.0
 */
@Api(tags = "洁净度主驾驶舱")
@RestController
@RequestMapping("/api/cleanliness")
public class CleanlinessLevelController {

    @Resource
    private CleanlinessLevelService cleanlinessLevelService;

    @ApiOperation(value = "新增洁净级别配置")
    @PostMapping("/createCleanlinessLevel")
    public Rest<String> createCleanlinessLevel(@RequestBody CleanlinessLevelDTO dto) {
        return cleanlinessLevelService.createCleanlinessLevel(dto);
    }

    @ApiOperation(value = "删除洁净级别配置")
    @DeleteMapping("/deleteCleanlinessLevel")
    public Rest<String> deleteCleanlinessLevel(String id) {
        return cleanlinessLevelService.deleteCleanlinessLevel(id);
    }

    @ApiOperation(value = "修改洁净级别配置")
    @PutMapping("/updateCleanlinessLevel")
    public Rest<String> updateCleanlinessLevel(@RequestBody CleanlinessLevelDTO dto) {
        return cleanlinessLevelService.updateCleanlinessLevel(dto);
    }

    @ApiOperation(value = "动态查询评级列表:type=1 优良差评级  type=2 数字评级")
    @GetMapping("/queryCleanlinessLevelList")
    public Rest<List<CleanlinessLevelVO>> queryCleanlinessLevelList(int type) {
        return Rest.ok(cleanlinessLevelService.queryCleanlinessLevelList(type));
    }

//    @ApiOperation(value = "填写评级范围低值和评级范围高值时的校验")
//    @PostMapping("/check")
//    public Rest<String> check(@RequestBody CleanlinessLevelDTO dto) {
//        return cleanlinessLevelService.check(dto);
//    }
}
